MCBank = function (string) {

	var seed = {};
	seed.id = getUniqueId();
	var sidebar = $('body').find('.side-bar .middle'),
		preview = $('body').find('.preview');
	
	seed.genXML = function () {
		var self = this;
		var bank = "";
				
		for(var i = 0; i < self.qtexts.length; i++)
		{
			feedback[i] = " ";
			var ansTemp = [];
			var added = 0;
			for(var j = 0; j < self.atexts.length ;j++)
			{
				if(j!=i)
				{
					ansTemp[added] = ans[j];
					added++;
				}
			}
			if(remainder > 0) {
				var answers = randomAnswers(ansTemp, self.numQuestions + 1);
				//console.log(num_per, 'added one');
				remainder--;
			} else {
				//console.log(num_per);
				var answers = randomAnswers(ansTemp, self.numQuestions);
			}
			var correctNum = 3;
			for(var k = 0; k < answers.length; k++)
			{
				answers[k].push(ans[i]);
			}
			//var name = "Question " + i;
			$.each(answers, function (index, element) {
				element.push(ans[i]);
				bank += writeMCQuestion(self.name, self.qtexts[i], element, self.feedback[i], correctNum);
			});	
		}
	};
	
	seed.genGift = function () {
		return "";
	};
	
	seed.genQSD = function () {
		return "";
	};
	
	seed.genPreviewHtml = function () {
		var self = this;
		
		var t = template('mc-bank-tmpl', self);
		
		preview.append(t);
		$.data(t.find('.seed'), self.id);
		
		t.on('click', function () {
			self.setForm();
		});
		
	};
	
	seed.setForm = function () {
		var self = this;
		
		sidebar.html(template('mc-bank-sidebar-tmpl', self));
		$.data(sidebar.find('.sidebar-seed'), self.id);
	
		sidebar.find('.particles').css('height', sidebar.height() - sidebar.find('.other-input').height() - 1 + 'px');
		
		sidebar.on('focus', '.mc-bank-particle:last .seed-data', function () {
			sidebar.find('.mcbank-sidebar .particles').append(template('mc-bank-particle-tmpl'));
		});
		
	};
	
	seed.set = function (options) {
		var self = this;
		$.each(options, function (key, value) {
			if (key === 'name') {
				self.name = value;
			} else if (key === 'qtexts') {
				self.qtexts = value;
			} else if (key === 'feedback') {
				self.feedback = value;
			} else if (key === 'numQuestions') {
				self.numQuestions = value;
			} else if (key === 'atexts') {
				self.atexts = value;
			}
		});
		seeds[seed.id] = self;
	};
	
	var randomAnswers = function (ratext/*[]*/, max)
	{
			var len = ratext.length;
			var retVal = [];			
			var n = 0;
			
			//Three for loops (choose three)
			for (var i = 0; i < len - 2; i++)
			{
				for (var j = i + 1; j < len - 1; j++)
				{
					for (var k = j + 1; k < len; k++) {
						retVal.push([ratext[i], ratext[j], ratext[k]])
						n++;
						if(n >= max) {
							return retVal;
						}
					}
				}
			}
			//console.log(retVal);
			return retVal;
	};
	
	var writeMCQuestion = function (name, qtext, watext/*[]*/, feedback/*[]*/, correctNum)
	{
		var string = "";
		//write MC header
		string += "\t<question type =\"multichoice\">\n";
		//write Name
		string += "\t\t<name>\n\t\t\t<text> <![CDATA[<p>" + name + "</p>]]></text>\n\t\t</name>\n";
		//write Text
		string += "\t\t<questiontext format =\"html\">\n\t\t";
		string += "<text> <![CDATA[<p>" + qtext + "</p>]]></text>\n\t\t</questiontext>\n";
		//write Answer
		for(var i = 0; i < 4; i++)
		{
			if(i == correctNum)
			{
				string += writeMCAnswer(true, watext[i], feedback);
			}
			else
			{
				string += writeMCAnswer(false, watext[i], feedback);
			}
		}
		//write footer
		string += "\t\t<shuffleanswers>1</shuffleanswers>\n\t\t<single>true</single>\n\t\t<answernumbering>ABCD</answernumbering>\n\t</question>\n";
		return string;
	};

	var writeMCAnswer = function (correct, text, feedback)
	{
		var answer = "";
		answer += "\t\t<answer fraction=\"";
		if(correct)
		{	
			answer += "100";
		}
		else
		{
			answer += "0";
		}
		
		answer += "\">\n\t\t\t\t<text> <![CDATA[<p>" + text + "</p>]]></text>\n\t\t\t\t<feedback><text>" + feedback + "</text></feedback>\n\t\t</answer>\n";
		return answer;
	};
	
	
	if (string) {
	
	};
	
	return seed;
};